﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BuildanArrayWithStackOperations
{
    public class Solution
    {
        public IList<string> BuildArray(int[] target, int n)
        {
            var operations = new List<string>();
            for (int i = 1, j = 0; j < target.Length && i <= n; i++)
            {
                operations.Add("Push");
                if (i == target[j])
                {
                    j++;
                }
                else
                {
                    operations.Add("Pop");
                }
            }

            return operations;
        }
    }
}
